package com.hoki.zj.Listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;

/**
 * MyJobListener
 * @Description: Jobの執行状況を監視する。
 */
public class MyJobListener implements JobExecutionListener{

    private Logger logger= LoggerFactory.getLogger(MyJobListener.class);

    /**
     * 1.執行前
     * @param jobExecution jobExecution
     */
    @Override
    public void beforeJob(JobExecution jobExecution) {
        logger.info("job　開始、id={}", jobExecution.getJobId());
    }

    /**
     * 2.執行後
     * @param jobExecution jobExecution
     */
    @Override
    public void afterJob(JobExecution jobExecution) {
        logger.info("job 終了、id={}", jobExecution.getJobId());
    }
}
